package farmaciaweb.com.br.util;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

@FacesConverter("farmaciaweb.com.br.CepConverter")
public class CepConverter implements Converter{
	
	@Override
	public Object getAsObject(FacesContext context, UIComponent component,
		String value) {
		String cep = value;
		cep = cep.replaceAll("\\-", "");
		return cep;
	}
	
	@Override
	public String getAsString(FacesContext context, UIComponent component,
			Object value) {
		return value.toString();
	}	
}
